﻿@using SCMS.Resources
@model SCMS.UI.Models.RegisterAsset
@using SCMS.CoreBusinessLogic.Settings
@{AjaxOptions ajaxOpts = new AjaxOptions
      {
          UpdateTargetId = "AssetsDiv",
          LoadingElementId = "loading",
          HttpMethod = "Post",
          Url = Url.Action("SaveOtherAsset"),
          OnSuccess = "javascript:usermsg();ClearOtherAssetForm();",
          OnFailure = "javascript:errormsg()"
      };}
<script src="@Url.Content("~/Scripts/js/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/js/jquery.autocomplete.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<input type="hidden" id="actionStatus" value="@ViewBag.Response" />
<input type="hidden" id="statusMsg" value="@ViewBag.msg" />
<div class="partialViewCard">
    <div class="partialViewCardHeader">
        <h3>@Resources_frank.GoodsReceivedNote_LoadOtherAssets_Header</h3>
    </div>
    @* @using (Html.BeginForm("SaveOtherAsset", "GoodsReceivedNote", FormMethod.Post, new { @id = "otherAssets", @class = "form", enctype = "multipart/form-data" }))*@
    @using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form", @id = "otherAssets", enctype = "multipart/form-data" }))
    {
        @Html.ValidationSummary(true)
        <br />
        <table width="98%" align="center" cellpadding="0">
            <tr class="gridheader2">
                <td align="center" width="33.3%">
                    @Resources_frank.Global_String_CurrentProject
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.Budget_CreateProject_ProjectNumber
                </td>
                <td align="center" width="33.3%">
                    @Resources_morgan.Global_String_AssetNo
                </td>
            </tr>
            <tr>
                <td align="center" valign="top">
                    @Html.DropDownListFor(x => x.ProjectId, Model.Projects, Resources_frank.Global_String_PleaseSelect, new { @id = "dplProject", onchange = "javascript:GetProjectNos4RegAsset(this)" })
                </td>
                <td align="center" id="ProjectNoDiv" valign="top">
                    @Html.DropDownListFor(x => x.EntityAsset.CurrentProjectDonorId, Model.ProjectDonors, Resources_frank.Global_String_PleaseSelect, new { @id = "dplProNo", onchange = "javascript:GetAssetNo(this)" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.CurrentProjectDonorId, Resources_frank.Global_String_Required)
                </td>
                <td align="center" valign="top">
                    @Html.TextBoxFor(x => x.EntityAsset.AssetNumber, new { @readonly = "readonly", id = "AssetNoId" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.AssetNumber, Resources_frank.Global_String_Required)
                </td>
            </tr>
            <tr class="gridheader2">
                <td align="center" width="33.3%">
                    @Resources_morgan.Global_String_ItemName
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.Global_String_AssetName
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.Global_String_WeightInKg
                </td>
            </tr>
            <tr>
                <td align="center" valign="top">
                    @Html.DropDownListFor(x => x.EntityAsset.ItemId, Model.Items, Resources_frank.Global_String_PleaseSelect, new { onchange = "javascript:GetItemPecentageDepre(this)" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.ItemId, Resources_frank.Global_String_Required)
                </td>
                <td align="center" valign="top">
                    @Html.TextBoxFor(x => x.EntityAsset.Name, new { id = "AssetDesc", name = "AssetDesc" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.Name, Resources_frank.Global_String_Required)
                    <script type="text/javascript">
                        var $jq = jQuery.noConflict();
                        $jq("#AssetDesc").autocomplete("/GoodsReceivedNote/SearchAssetDesc");
                    </script>
                </td>
                <td align="center" valign="top">
                    @Html.TextBoxFor(x => x.EntityAsset.Weight, new { id = "weight", @class = "numericTb" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.Weight, Resources_frank.Global_String_Required)
                </td>
            </tr>
            <tr class="gridheader2">
                <td align="center" width="33.3%">
                    @Resources_morgan.Global_String_SerialNo
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.Global_String_EstLifespan
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.Global_String_UseEstLifespan
                </td>
            </tr>
            <tr>
                <td align="center" valign="top">
                    @Html.EditorFor(x => x.EntityAsset.SerialNumber)
                    @Html.ValidationMessageFor(x => x.EntityAsset.SerialNumber, Resources_frank.Global_String_Required)
                </td>
                <td align="center" valign="top">
                    @Html.TextBoxFor(x => x.EntityAsset.Lifespan, new { id = "lifespan", @class = "numericTb" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.Lifespan, Resources_frank.Global_String_Required)
                </td>
                <td align="center" valign="top">
                    @Html.CheckBoxFor(x => x.EntityAsset.UseLifeSpan, new { id = "useLifeSpan", name = "useLifeSpan" })
                </td>
            </tr>
            <tr class="gridheader2">
                <td align="center" width="33.3%">
                    @Resources_frank.GoodsReceivedNote_LoadOtherAssets_PurchaseCurrency
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.GoodsReceivedNote_LoadOtherAssets_PurchasePrice
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.GoodsReceivedNote_GRAssetList_SalvageValue
                </td>
            </tr>
            <tr>
                <td align="center" valign="top">
                    @Html.DropDownListFor(x => x.EntityAsset.DepreciationCurrencyId, Model.Currencies, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.EntityAsset.DepreciationCurrencyId, Resources_frank.Global_String_Required)
                </td>
                <td align="center" valign="top">
                    @Html.TextBoxFor(x => x.EntityAsset.PurchaseValue, new { id = "purcahseValue", @class = "numericTb" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.PurchaseValue, Resources_frank.Global_String_Required)
                </td>
                <td align="center" valign="top">
                    @Html.TextBoxFor(x => x.EntityAsset.SalvageValue, new { id = "salvageValue", @class = "numericTb", onblur = "javascript:ValidateSalvageValue(this);" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.SalvageValue, Resources_frank.Global_String_Required)
                </td>
            </tr>
            <tr class="gridheader2">
                <td align="center" width="33.3%">
                    @Resources_frank.GoodsReceivedNote_LoadOtherAssets_DepreciationType
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.GoodsReceivedNote_LoadOtherAssets_PercentageDep
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.GoodsReceivedNote_LoadOtherAssets_OpeningDep
                </td>
            </tr>
            <tr>
                <td align="center" valign="top">
                    @Html.DropDownListFor(x => x.EntityAsset.DepreciationType, new SelectList(
                        new List<Object>{ 
                            new { value = "Straight Line" , text = Resources_frank.Global_DepreciationType_StraightLine  },
                            new { value = "Reducing Balance" , text = Resources_frank.Global_DepreciationType_ReducingBalance },
                            new { value = "Zero Balance" , text = Resources_frank.Global_DepreciationType_ZeroBalance}
                        }, "value", "text"), Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.EntityAsset.DepreciationType)
                </td>
                <td align="center" valign="top">
                    @Html.TextBoxFor(x => x.EntityAsset.PercentageDepr, new { @id = "depreciation", @class = "numericTb" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.PercentageDepr, Resources_frank.Global_String_Required)
                </td>
                <td align="center" valign="top">
                    @Html.TextBoxFor(x => x.EntityAsset.OpeningAccDepreciaiton, new { @class = "numericTb" })
                    @Html.ValidationMessageFor(x => x.EntityAsset.OpeningAccDepreciaiton, Resources_frank.Global_String_Required)
                </td>
            </tr>
            <tr class="gridheader2">
                <td align="center" width="33.3%">
                    @Resources_morgan.Global_String_Warehouse
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.Global_String_PurchaseDate
                </td>
                <td align="center" width="33.3%">
                    @Resources_frank.GoodsReceivedNote_LoadOtherAssets_IsFleet
                </td>
            </tr>
            <tr>
                <td align="center" valign="top">
                    @Html.DropDownListFor(x => x.EntityAsset.CurrentWareHouseId, Model.Warehouses, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.EntityAsset.CurrentWareHouseId, Resources_frank.Global_String_Required)
                </td>
                <td align="right">
                    @Html.EditorFor(x => x.EntityAsset.AcquisionDate)
                    @Html.ValidationMessageFor(x => x.EntityAsset.AcquisionDate, Resources_frank.Global_String_Required)
                </td>
                <td align="center" valign="top">
                    @Html.EditorFor(x => x.EntityAsset.IsFleet)
                    @Html.ValidationMessageFor(x => x.EntityAsset.IsFleet, Resources_frank.Global_String_Required)
                </td>
            </tr>
        </table>
        <center>
            <input type="submit" class="btn green" value="@Resources_frank.GoodsReceivedNote_LoadGRAssetItems_RegisterAsset" /></center>
        <hr />
    }
</div>
